<?php 

include '../function.php';
//建立链接
$res = @mysql_connect("127.0.0.1","root",'');



if (!$res) {
	exit("数据链接失败：原因：".mysql_errno().":".mysql_error());
}

//选择数据库
$res = mysql_select_db('school');



if (!$res) {
	exit("数据库选择失败：原因：".mysql_errno().":".mysql_error());
}


//设置字符集
mysql_query("set names utf8");


$sql = "select * from stu";

$sql = "show tables";


$sql = "select * from class";


$sql = "select * from stu t1 inner join class t2 on t1.cid=t2.cid where t1.name='小明'";

// $sql = "update st234234u set sex='女' where name='小明'";
// 
// 
for ($i=0; $i <1000 ; $i++) { 

	$sql = "insert into stu (name,age) values('小明".$i."',".$i.")";
	$res = mysql_query($sql);
	
}

$res = mysql_query($sql);

if (!$res) {
	exit("执行失败：原因：".mysql_errno().":".mysql_error());
}

$tempArr = array();


while ($row = mysql_fetch_assoc($res)) {
	$tempArr [] = $row;
}


var_dump($tempArr);



mysql_close();








 ?>